package org.davidtrevien.com.imput.omi.panels.center.planning;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.davidtrevien.com.imput.datamodel.os.OS;
import org.davidtrevien.com.imput.datamodel.task.Task;

public class PlanningModel {
	
	int currentMonth;

	List<OS> osList = new ArrayList<OS>();
	
	Map<Integer, Map<Integer, Task>> taskMap = new HashMap<Integer, Map<Integer, Task>>();

	private int currentYear;

	public void addTask(Task e) {
		int osId = e.getOs().getId();
		Map<Integer, Task> taskList = this.taskMap.get(osId);
		if (taskList == null) {
			taskList = new HashMap<Integer, Task>();
			this.taskMap.put(osId, taskList);
		}
		taskList.put(e.getId(), e);
	}

	public Task getTask(int osId, int index) {
		Map<Integer, Task> taskList = this.taskMap.get(osId);
		if (taskList == null) {
			taskList = new HashMap<Integer, Task>();
			this.taskMap.put(osId, taskList);
		}
		return taskList.get(new Integer(index));
	}

	public boolean addOS(OS e) {
		return this.osList.add(e);
	}

	public OS getOS(int index) {
		return this.osList.get(index);
	}

	public List<OS> getOsList() {
		return new ArrayList<OS>(this.osList);
	}

	public Map<Integer, Task> getTaskList(int os) {
		return new HashMap<Integer, Task>(this.taskMap.get(os));
	}

	public int getCurrentMonth() {
		return this.currentMonth;
	}

	public void setCurrentMonth(int currentMonth) {
		this.currentMonth = currentMonth;
	}

	public void setCurrentYear(int currentYear) {
		this.currentYear = currentYear;
	}
	
	public int getCurrentYear() {
		return this.currentYear;
	}
	
	
}
